# -*- coding: UTF-8 -*-
"""获取龙虎榜数据
# 
"""
import efinance as ef
import os
from datetime import date
 
# 获取当前日期
todayStr = date.today()
# 打印当前日期
# print(today) #2025-01-08

current_path = os.getcwd()
# print('当前路径：'+ current_path)
 
def get_daily_billboard() -> str:
    try:
        # 获取相应股票代码数据到Pandas 数据结构 - DataFrame
        start_date = '2025-01-07'# 开始日期
        end_date = '2025-01-08' # 结束日期
        daily_billboard=ef.stock.get_daily_billboard(start_date = start_date,end_date = end_date)
        # 存储路径
        pathWay=current_path+f"/code/Stock/data/110/{todayStr}.csv"
        # 存储相应股票代码数据到CSV
        daily_billboard.to_csv(pathWay, index=False)
    except Exception:
        # print(Exception)
        return 'error'
    else:
        return 'ok'


result=get_daily_billboard()
print(result)

    



